package com.swind.fast.modules.app.railway.task.constant;

import com.swind.fast.common.util.oConvertUtils;

/**
 * Query 规则 常量
 */
public enum TaskPointStatusEnum {
    TASKED(1, "tasked", "已下达 - 任务书"),
    UPLOADED(2, "uploaded", "已完成 - 现场测试"),
    UNQUALIFIED(3, "unqualified", "外业质量评价 - 不合格"),
    QUALIFIED(4, "qualified", "外业质量评价 - 合格"),
    ANALYZED(5, "analyzed", "整理完成"),
    APPROVING(6, "approving", "提交复核"),
    UNAPPROVED(7, "unapproved", "复核 - 不通过"),
    APPROVED(8, "approved", "复核 - 通过");

    private Integer value;
    private String name;
    private String msg;

    TaskPointStatusEnum(Integer value, String name, String msg){
        this.value = value;
        this.name = name;
        this.msg = msg;
    }

    public Integer getValue() {
        return value;
    }

    public void setValue(Integer value) {
        this.value = value;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static TaskPointStatusEnum getByValue(String value){
        Integer ivalue = oConvertUtils.getInt(value);
        if(ivalue == 0) {
            return null;
        }
        for(TaskPointStatusEnum val :values()){
            if (val.getValue().equals(ivalue) || val.getName().equals(value)){
                return val;
            }
        }
        return null;
    }

    public static TaskPointStatusEnum getByName(String name){
        if (oConvertUtils.isEmpty(name)) {
            return null;
        }
        for (TaskPointStatusEnum val :values()) {
            if (val.getName().equals(name)) {
                return val;
            }
        }
        return null;
    }
}
